/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */


import Server.BUS.StringUlti;
import Server.DTO.DeleteHaveWhereQuery;
import org.junit.*;
import static org.junit.Assert.*;

/**
 *
 * @author Trung
 */
public class DeleteHaveWhereQueryTest {
    
    public DeleteHaveWhereQueryTest() {
    }

    @BeforeClass
    public static void setUpClass() throws Exception {
    }

    @AfterClass
    public static void tearDownClass() throws Exception {
    }
    
    @Before
    public void setUp() {
    }
    
    @After
    public void tearDown() {
    }
    
    
    @Test
    public void testDeleteHaveWhereQueryContructor1()
    {
        // TODO review the generated test code and remove the default call to fail.
        String queryString = "DELETE FROM TableA a WHERE a.id = 3";
        queryString = StringUlti.formatString(queryString);
        DeleteHaveWhereQuery dhw = new DeleteHaveWhereQuery(queryString);
        
        assertTrue(dhw.keyWord.equalsIgnoreCase("DELETE_HAVEWHERE"));
        assertTrue(dhw.queryString.equalsIgnoreCase(queryString));
        assertTrue(dhw.tableName.equalsIgnoreCase("TableA a"));     
        assertTrue(dhw.whereString.equalsIgnoreCase("a.id = 3"));
    }
    
    @Test
    public void testDeleteHaveWhereQueryContructor2()
    {
        // TODO review the generated test code and remove the default call to fail.
        String queryString = "   DELETE     FROM    TableA a WHERE a.id = 3    ";
        queryString = StringUlti.formatString(queryString);
        DeleteHaveWhereQuery dhw = new DeleteHaveWhereQuery(queryString);
        
        assertTrue(dhw.keyWord.equalsIgnoreCase("DELETE_HAVEWHERE"));
        assertTrue(dhw.queryString.equalsIgnoreCase(queryString));
        assertTrue(dhw.tableName.equalsIgnoreCase("TableA a"));     
        assertTrue(dhw.whereString.equalsIgnoreCase("a.id = 3"));
    }
    


}
